package com.itdct.onflow.system.generator

import com.itdct.onflow.com.itdct.onflow.system.generator.config.SysGeneratorConfig
import com.itdct.onflow.com.itdct.onflow.system.generator.core.SystemGenerator
import com.itdct.onflow.generator.constant.GroupEnum
import com.itdct.onflow.generator.template.*
import com.itdct.onflow.generator.template.web.*
import com.itdct.onflow.system.monitor.entity.SysMachineReportEntity

/**
 * @author Zhouwx
 * @date 2025/9/9 18:27:21
 * @version 1.0
 * @description
 */
fun main() {
    Main().generate()
}

class Main {
    fun generate() {
        val generatorConfig = SysGeneratorConfig()
        generatorConfig.projectGen = true
        generatorConfig.sessionVersion = "20250818"
        generatorConfig.backupPath = "C:\\Cache\\ITDCT\\Backup"
        generatorConfig.generateLog = true
        generatorConfig.forceOverwrite = true
        generatorConfig.authorName = "DCTANT"

        generatorConfig.databaseIp = "192.168.1.230"
        generatorConfig.databaseName = "onflow"
        generatorConfig.databasePort = "33306"
        generatorConfig.databaseUserName = "root"
        generatorConfig.databasePassword = "qwerty"
        generatorConfig.groupId = "com.itdct.onflow"
        generatorConfig.contextPath = "/admin"

        generatorConfig.groupModulePath[GroupEnum.BACKEND] = "C:\\Project\\1_MyProject\\onflow-framework\\onflow-system"
        generatorConfig.groupModulePath[GroupEnum.MAPPER_XML] = "C:\\Project\\1_MyProject\\onflow-framework\\onflow-system"
        generatorConfig.groupModulePath[GroupEnum.FRONTEND] = "C:\\Project\\1_MyProject\\onflow-web-admin"

        generatorConfig.generateFile = true
        generatorConfig.syncTable = true
        generatorConfig.syncMenu = true
        generatorConfig.syncApi = true
        generatorConfig.syncApiMenu = true
        generatorConfig.syncComponent = true

        val codeGenerator = SystemGenerator(
            generatorConfig, arrayListOf(
                EditQoTemplate::class.java,
                SearchQoTemplate::class.java,
                ListVoTemplate::class.java,
                DetailVoTemplate::class.java,
                MapperJavaTemplate::class.java,
                MapperXmlTemplate::class.java,
                ManagerTemplate::class.java,
                ServiceTemplate::class.java,
                ControllerTemplate::class.java,
                VueTypesTemplate::class.java,
                VueIndexTemplate::class.java,
                VueEditTemplate::class.java,
                VuePageTemplate::class.java,
                VueWriteTemplate::class.java
            )
        )

//        generator.generates(SysAccountEntity::class.java, SysDictEntity::class.java)
        codeGenerator.generates(
//            SysApiMenuEntity::class.java,
//            SysAccountEntity::class.java,
//            SysRoleComponentEntity::class.java,
//            SysMessageEntity::class.java,
//            SysTaskEntity::class.java,
//            SysLoginLogEntity::class.java,
//            SysApiLogEntity::class.java,
//            SysImportantApiLogEntity::class.java,
//            SysFileEntity::class.java,
//            SysTransferCenterEntity::class.java,
//            SysTransferCenterFileRelEntity::class.java,
//            SysFileFailReasonEntity::class.java,
//            SysMachineInfoEntity::class.java,
            SysMachineReportEntity::class.java,
//            SysApiEntity::class.java,
//            SysDictEntity::class.java,
//            SysRoleMenuEntity::class.java,
//            SysConfigurationEntity::class.java,
//            SysMenuEntity::class.java,
//            SysRoleAccountEntity::class.java,
//            SysRoleEntity::class.java,
//            SysComponentEntity::class.java,
        )
    }
}